<!DOCTYPE html>
<html lang="en"  xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑用户</title>
    <link rel="stylesheet" href="__PEAR__/component/pear/css/pear.css" />
</head>
<body>
<form class="layui-form" action="">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">
            
                  <div class="layui-form-item">
				    <label class="layui-form-label">登录账户</label>
				    <div class="layui-input-inline">
				      <input type="text" name="loginname" value="{$one['loginname']}" required  lay-verify="required" placeholder="请输入登录名称" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">用户名称</label>
				    <div class="layui-input-inline">
				      <input type="text" name="username" value="{$one['username']}" required  lay-verify="required" placeholder="请输入用户名称" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">登录密码</label>
				    <div class="layui-input-inline">
				      <input type="password" name="password" value="" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">确认密码</label>
				    <div class="layui-input-inline">
				      <input type="password" name="repassword" value="" placeholder="请输入二次确认密码" autocomplete="off" class="layui-input">
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">用户角色</label>
				    <div class="layui-input-inline">
				       <select name="role" lay-filter="roletype">
				       	{volist name="rolelist" id="vo"}
							<option {if condition="$vo['rid'] eq $one['rid']"}selected="selected"{/if} value="{$vo['rid']}|{$vo['name']}">{$vo['name']}</option>
						{/volist}		
						</select>
				    </div>
				  </div>
				  
				  <div class="layui-form-item">
				    <label class="layui-form-label">用户状态</label>
				    <div class="layui-input-inline">
				      <input type="radio" name="status"  value="1" {if condition="$one['status'] eq 1 OR empty($one)"} checked="checked"{/if} title="开启" >
						<input type="radio" name="status" value="0" {if condition="$one['status'] eq 0 AND !empty($one)"} checked="checked"{/if} title="禁止">
				    </div>
				  </div>
				  
        		<input name="id" type="hidden" value="{$one['id']}"/>
            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="pear-btn pear-btn-primary pear-btn-sm" lay-submit="" lay-filter="operator-save">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="pear-btn pear-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<script src="__STATIC__/lib/layui/layui.js"></script>
<script src="__PEAR__/component/pear/pear.js"></script>
<script>
layui.use(['form','jquery'],function(){
    let form = layui.form;
    let $ = layui.jquery;
    var path="/{$MODULE_NAME}/Manager";
	var _url="/save";

    form.on('submit(operator-save)', function(data){
    	
        $.ajax({
            url:path+_url,
            data:JSON.stringify(data.field),
            dataType:'json',
            contentType:'application/json',
            type:'post',
            success:function(result){
                if(result.code){
                    layer.msg(result.msg,{icon:1,time:1000},function(){
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("manager-table");
                    });
                }else{
                    layer.msg(result.msg,{icon:2,time:1000});
                }
            }
        })
        return false;
    });
})
</script>
<script>
</script>
</body>
</html>